/************************************************************************
 * AIDE/Examples - Automata Identification Engine
 * Copyright (C) 2012-2013 Ali Khalili (khalili_DOT_ir_@SIGN_gmail_DOT_com)
 * **********************************************************************
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License (LGPL) published 
 * by the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version. This program is distributed without any
 * warranty. See the GNU Lesser General Public License for more details. 
 * ***********************************************************************
 * File         :     
 * Description  :     
 * Change log   :     	-Date:  Change
 ************************************************************************/
﻿using System;
using System.Collections.Generic;
using SMLib.Automata.DFA;
using SMLib.Automata.Base;
using AIDE.Base;
using AIDE.Oracles.DFAs;
using AIDE.OnlineAlgo.DFAs;

namespace LearningApp.Examples
{
    /// <summary>
    /// Example to show how to learn a DFA
    /// </summary>
    public class LearnDFA
    {
        public static void RunExample()
        {
            //* import a DFA from file
            DFA dfa = SMLib.Interoperability.DOT.DotHelper_DFA.ReadFromDOT("sampleDFA.dot");
            //* make an emulator
            SUL_Emulator_DFA emul = new SUL_Emulator_DFA(dfa, false);
            //* define a realistic oracle 
            Oracle_MAT_DFA_Realistic myOracle = new Oracle_MAT_DFA_Realistic(emul);
            //* instantiate a learner
            L_Star learner = new L_Star(myOracle);
            //* call the learning procedure
            DFA conj = learner.Learn();
            //* export the conjecture into a DOT file
            //conj.ExportAsDot(LibSetting.WorkingPath + "sampleResultofLStar.dot");
            SMLib.Interoperability.DOT.DotHelper_DFA.WriteToDot("sampleResultofLStar.dot", conj);

            Console.WriteLine("The learnt DFA model is exported as: sampleResultofLStar.dot");
        }
    }
}
